DMLMODS = 2-campus-tcp.dml

#SSFNET_DIR = /home/dongjin2/SVNROOT/ethernet_full_duplex/ssfnet
#SSFNET_DIR = /home/dongjin2/SVNROOT/ethernet_full_duplex_doff/ssfnet
SSFNET_DIR = /home/dongjin2/SVNROOT/trunk/ssfnet

OTHERDMLS = ../support/networks.dml ../support/params.dml
DMLENVS = $(DMLMODS:.dml=.env.dml)
DMLRTS = $(DMLMODS:.dml=.rt.dml)
SIM_TIME = 5 
OUT_FILE = a.out

ROUTABLES = "*:1:2,*:1:3,*:1:4,*:1:5"

all:	2-campus-tcp.dml 2-campus-tcp.env.dml 2-campus-tcp.rt.dml

test: run2camps

%.env.dml:	%.dml $(OTHERDMLS)
	$(SSFNET_DIR)/dmlenv -b 10.10.0.0 $< $(OTHERDMLS) > $@

%.rt.dml:	%.dml $(OTHERDMLS)
	$(SSFNET_DIR)/dmlenv -r $(ROUTABLES) $< $(OTHERDMLS) > $@

run:
	$(SSFNET_DIR)/ssfnet $(SIM_TIME) $(DMLMODS) $(DMLENVS) $(DMLRTS) $(OTHERDMLS) > $(OUT_FILE)

run2camps:	2-campus-tcp.dml 2-campus-tcp.env.dml 2-campus-tcp.rt.dml $(OTHERDMLS)
	@ echo "THE FOLLOWING TEST MAY TAKE A LONG TIME TO RUN (DEPENDING ON THE SPEED OF YOUR MACHINE)"
	@ if ./test.run "$(SSFNET_DIR)/ssfnet -silent -q 1000 2-campus-tcp.dml 2-campus-tcp.env.dml 2-campus-tcp.rt.dml $(OTHERDMLS)"; then \
	  echo "----------------------------"; \
	  echo "baseline/2-campus-tcp PASSED"; \
	  echo "----------------------------"; \
	else \
	  echo "----------------------------"; \
	  echo "baseline/2-campus-tcp FAILED"; \
	  echo "----------------------------"; \
	fi

clean:
	rm -f *.env.dml *.rt.dml *~ .tmpdat*
